package com.wyk.controller;

import com.wyk.bean.Payment;
import com.wyk.common.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author WangYuKai
 * @Date 2022/7/31
 * @apiNote
 */
@RestController
public class PaymentController {
    //端口号
    @Value("${server.port}")
    public String serverPort;

    public static HashMap<Long, Payment> hashMap = new HashMap<>();
    static {
        hashMap.put(1L,new Payment(1L,"asdfasdfasdf"));
        hashMap.put(2L,new Payment(2L,"asdfasdfasdf"));
        hashMap.put(3L,new Payment(3L,"asdfasdfasdf"));
    }

    @GetMapping("/paymentSQL/{id}")
    public Result paymentSQL(@PathVariable("id")Long id){
        return new Result(200,"访问的服务端口是：" + serverPort,hashMap.get(id));
    }
}
